package com.eig.courseweb.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.eig.common.entity.order.TOrder;
import com.eig.common.vo.Result;
import com.eig.courseweb.dao.OrderDao;
import com.eig.courseweb.service.OrderService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author ：StudentLsj（李世界）
 * @date ：Created in 2023/01/13 下午 05:19
 * @description：
 * @modified By：
 * @version:
 */
@Service
public class OrderServiceImpl implements OrderService {

    @Resource
    private OrderDao orderDao;
    @Override
    public Result getOrderStatus(String id, String huiYuanId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("course_id",id);
        queryWrapper.eq("member_id",huiYuanId);
        TOrder tOrder = orderDao.selectOne(queryWrapper);
        if (ObjectUtil.isNotEmpty(tOrder)) {

            return new Result(2000,"查询成功",tOrder);
        }
        return new Result(5000,"查询失败",tOrder);
    }
}
